package si.unimb.src.wifisms.entity;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * 
 * @author Ales
 * 
 * Raznorazne nastavitve aplikacije.
 *
 */
public class Settings {

	// Shared preferences
	public static final String PREFS_NAME = "WifiSMSPreferences";
	public static final String PREFS_WIFI = "allow_wifi";
	public static final String PREFS_MOBILE = "allow_mobile";
	
	public static void setAllowWifi(Context context, boolean value) {
		
		SharedPreferences settings = context.getSharedPreferences(PREFS_NAME, 0);
		SharedPreferences.Editor editor = settings.edit();
		editor.putBoolean(PREFS_WIFI, value);
		editor.commit();
		
	}
	
	public static boolean getAllowWifi(Context context) {
		
		SharedPreferences settings = context.getSharedPreferences(PREFS_NAME, 0);
		return settings.getBoolean(PREFS_WIFI, true);
		
	}
	
	public static void setAllowMobile(Context context, boolean value) {
		
		SharedPreferences settings = context.getSharedPreferences(PREFS_NAME, 0);
		SharedPreferences.Editor editor = settings.edit();
		editor.putBoolean(PREFS_MOBILE, value);
		editor.commit();
		
	}
	
	public static boolean getAllowMobile(Context context) {
		
		SharedPreferences settings = context.getSharedPreferences(PREFS_NAME, 0);
		return settings.getBoolean(PREFS_MOBILE, false);
		
	}
	
	// Komunikacija z WS
	public static final byte MAX_TRIES = 3;
	public static final long WAIT_BETWEEN_TRIES = 2000; // v ms
	public static final int TIMEOUT = 10000; // v ms
	
	// Kako dolgo je veljaven en token
	public static final long TOKEN_LIFETIME = 900000; // v ms (15 min)
	
}
